<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Object.defineProperty</title>
  </head>
  <body>
    <script type="text/javascript">
    var obj1 = {};
    var descriptor = Object.create(null); // 没有继承的属性
    // 默认没有 enumerable，没有 configurable，没有 writable
    descriptor.value = 'static';
    Object.defineProperty(obj1, 'key', descriptor);
    console.log(obj1);
    </script>

    <script type="text/javascript">
    // 显式
    var obj2 = {};
    Object.defineProperty(obj2, 'key', {
        enumerable: true,
        configurable: false,
        writable: false,
        value: 'static',
    });
    console.log(obj2);
    </script>
  </body>
</html>
